<!DOCTYPE html>
<head>
    <#assign dicSelect=JspTaglibs["http://www.casic304.cn/dicSelect"] />
    <#assign secSelect=JspTaglibs["http://www.casic304.cn/secSelect"] />
    <#assign fillDept=JspTaglibs["http://www.casic304.cn/fillDept"] />
    <meta charset="utf-8">
    <title>专家信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/iconfont/iconfont.css"/>
    <!--<link rel="stylesheet" href="/qbdmsStatic/style/forms/currencyCss.css">-->
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/qbdms.css">
    <script type="text/javascript">
        var __ctx = "${ctx}";
    </script>
    <#if isClose == 'true'>
    <style>
        .listBody .qbdms-bodyDiv{padding: 0 }
        body.qbdms-particulars .qbdms-bodyDiv div.layui-table-view-body{padding: 16px}
        .layui-form-select .layui-input{padding-right: 0}
    </style>
</#if>
</head>
<body class="listBody qbdms-particulars">
<div class="qbdms-bodyDiv">
    <div class="layui-table-view-body qbdms-add-view-body">
        <#if isClose != 'true'><div class="qbdms-formTitle">专家信息<i class="qbdms-returnOn closeWindow">返回</i></div></#if>
        <form class="layui-form" requrl="${ctx}/qbdms/wQbdTeamExpertgroup/get" lay-filter="wQbdTeamExpertgroupDataForm">

            <div class="" style="width: 100%;overflow-x: auto">
                <!--<div class="dragInfo temSpace" colspan="2" rowspan="1" id="tbxx"></div>-->
                <table class="tableExcel qbdms-zeroTable" width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tbody>
                    <tr id="tbxx"></tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">密级<span style="color: red;">*</span></td>
                        <td ><@secSelect.sec_select data_src=1 required=true name="secret"/></td>
                        <td class="qbdms-zeroTable-lable">姓名<span style="color: red;">*</span></td>
                        <td name="name"></td>
                        <td class="qbdms-zeroTable-lable">类别<span style="color: red;">*</span></td>
                        <td ><@dicSelect.dic name="classification" reqtext="类别是必填项" verify="required" nodeKey="zjlb" /></td>
                    </tr>

                    <tr>
                        <td class="qbdms-zeroTable-lable">初评年度<span style="color: red;">*</span></td>
                        <td name="assessmentyear"></td>
                        <td class="qbdms-zeroTable-lable">技术领域<span style="color: red;">*</span></td>
                        <td ><@dicSelect.dic name="technical" reqtext="技术领域是必填项" verify="required" nodeKey="zjjzly" /></td>
                        <td class="qbdms-zeroTable-lable">工作单位<span style="color: red;">*</span></td>
                        <td name="workdept"></td>
                    </tr>

                    <tr>
                        <td class="qbdms-zeroTable-lable">核定年度<span style="color: red;">*</span></td>
                        <td name="approvedyear"></td>
                        <td class="qbdms-zeroTable-lable">性别<span style="color: red;">*</span></td>
                        <td ><@dicSelect.dic name="sex" verify="required" reqtext="性别是必填项" nodeKey="zjxb" /></td>
                        <td class="qbdms-zeroTable-lable">身份证号<span style="color: red;">*</span></td>
                        <td name="idnumber"></td>
                    </tr>

                    <tr>
                        <td class="qbdms-zeroTable-lable">年龄</td>
                        <td name="age"></td>
                        <td class="qbdms-zeroTable-lable">组内职务<span style="color: red;">*</span></td>
                        <td ><@dicSelect.dic name="groupduty" verify="required" reqtext="组内职务是必填项" nodeKey="znzw" /></td>
                        <td class="qbdms-zeroTable-lable">民族<span style="color: red;">*</span></td>
                        <td ><@dicSelect.dic name="nation" verify="required" reqtext="民族是必填项" nodeKey="mz" /></td>
                    </tr>

                    <tr>
                        <td class="qbdms-zeroTable-lable">政治面貌</td>
                        <td ><@dicSelect.dic name="politicalaspects" nodeKey="zzmm" /></td>
                        <td class="qbdms-zeroTable-lable">行政职务</td>
                        <td name="admpositions"></td>
                        <td class="qbdms-zeroTable-lable">技术职务</td>
                        <td ><@dicSelect.dic name="techpositions" nodeKey="jzzw" /></td>
                    </tr>

                    <tr>
                        <td class="qbdms-zeroTable-lable">技术职称</td>
                        <td ><@dicSelect.dic name="techtitle" nodeKey="jzzc" /></td>
                        <td class="qbdms-zeroTable-lable">所学专业</td>
                        <td ><@dicSelect.dic name="major" nodeKey="sxzy" /></td>
                        <td class="qbdms-zeroTable-lable">从事专业</td>
                        <td ><@dicSelect.dic name="workindustry" nodeKey="cszy" /></td>
                    </tr>

                    <tr>
                        <td class="qbdms-zeroTable-lable">联系电话（手机）</td>
                        <td name="mobile"></td>
                        <td class="qbdms-zeroTable-lable">办公室座机</td>
                        <td name="tel"></td>
                        <td class="qbdms-zeroTable-lable">是否在职</td>
                        <td ><@dicSelect.dic name="iswork"  nodeKey="sf" /></td>
                    </tr>

                    <tr>
                        <td class="qbdms-zeroTable-lable">退休/返聘</td>
                        <td ><@dicSelect.dic name="workstatus" nodeKey="txfp" /></td>
                        <td class="qbdms-zeroTable-lable">通讯地址</td>
                        <td name="address" colspan="3"></td>
                    </tr>

                    <tr>
                        <td class="qbdms-zeroTable-lable">备注</td>
                        <td name="remark" colspan="5"></td>
                    </tr>

                    <tr>
                        <td class="qbdms-zeroTable-lable">推荐表</td>
                        <td colspan="5">
                            <div class="uploadFileList" fileUploadName="recommendfile"></div>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <input type="hidden" name="id" placeholder=""
                       autocomplete="off" class="layui-input  textInput"
                       maxlength="50" fieldname="id">
                <input type="hidden" name="workdeptid" placeholder=""
                       autocomplete="off" class="layui-input  textInput">
            </div>
            <#if isClose != 'true'>
            <div class="layui-form-item btnformItem">
                <p>
                    <button type="reset" id="closeWindow" class="layui-btn layui-btn-sm btn-save qbdms-oneBtnLine">返回</button>
                </p>
            </div>
            </#if>
        </form>
    </div>
</div>

<script src="${ctx}/qbdmsStatic/public/configFile.js"></script>
<script src="${ctx}/layui/layui.js"></script>
<script>

    layui.config({
        base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','setter', 'propsHandle', 'laydate', 'jquery','commonDialog', 'common','publicMethods','qbdmsForm'], function () {
        var laydate = layui.laydate;
        var $ = layui.jquery;
        var form = layui.qbdmsForm;
        var publicMethods = layui.publicMethods;
        var common = layui.common;
        var upload = layui.upload;
        var setter = layui.setter;
        var ice = layui.ice;
        var propsHandle = layui.propsHandle;
        var dateTimeFiledLen = $(".dateTimeFiled");



        var  defProps = {
                //viewMould: 'form/formDef/view/formDesign/moulds/', // 组件模块 存放文件 *****
                viewMould: 'moulds/', // 组件模块 存放文件 *****
                formAreaInfo: '.formPreview',
                formAreaInfo: 'html',
                temDate: '.temDate',
                uploadFileBtn: '.uploadFileBtn',
                uploadImgBtn: '.uploadImgBtn',
                richTextArea: '.richTextArea',
                selectInput: '.selectInput',
                radioOptionCont: '.radioOptionCont',
                dataLexiTree: '.dataLexiTree',
                selectorBtn: '.selectorBtn'
            },
            temQuery = new propsHandle();  // 实例化模板功能部分

        // 初始化模板功能
        temQuery.initTem({
            selectorBtn: defProps.selectorBtn,
            selectorTemPath: setter.views + defProps.viewMould
        });


        for (var i = 0; i < dateTimeFiledLen.length; i++) {
            laydate.render({
                elem: dateTimeFiledLen[i] //指定元素
                , type: 'date'
                , trigger: 'click'
            });
        }
        var dateYears = $(".years");
        for (var i = 0; i < dateYears.length; i++) {
            laydate.render({
                elem: dateYears[i] //指定元素
                , type: 'year'
                , trigger: 'click'
            });
        }

        $(function () {
            $("input[name='idnumber']").on("input", function (e) {
                if (e.delegateTarget.value.length > 14) {
                    var idnumber = $("#idnumber").val();
                    var birth = 0;
                    if (idnumber.length === 15) {
                        birth = '19' + idnumber.substr(6, 2);
                    } else if (idnumber.length === 18) {
                        birth = idnumber.substr(6, 4);
                    } else if (idnumber.length > 18) {
                        $("#age").val("");
                        return;
                    }

                    if (birth !== 0) {
                        var date = new Date();
                        var year = date.getFullYear();
                        var age = parseInt(year) - parseInt(birth);
                        if (!isNaN(age) && age > 0) {
                            $("#age").val(age);
                        }
                    }

                } else {
                    $("#age").val("");
                }
            });
        });

        //关闭当前页面
        $("#closeWindow,.closeWindow").click(function () {
            window.location.href = '${ctx}/qbdms/wQbdTeamExpertgroup/view/list';
        });

        form.verify({
            num: function (value) {
                // 如果值为空，不触发校验
                if (value && !new RegExp(/^1[3456789]\d{9}$/).test(value)) return "手机号码有误";

            },
            servicePhone: function (value) {
                // 如果值为空，不触发校验
                // if (value && !new RegExp(/^$|(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$/).test(value)) return "座机格式不正确";
                if (value && !new RegExp(/^([0-9]{1,6}[-]?)?([0][1-9][0-9]{1,2}[-]?)?[0-9]{6,8}$/).test(value)) return "座机格式不正确";
            },
            fileRequired: [/[\S]+/, "没有上传对应附件"]
        });

        //-- 附件上传 开始 --------------------------------------------------------------
        //下载附件
        window.downFile = function (obj) {
            var fileId = $(obj).parents("span").attr("fileId");
            window.location.href = serverPath.qbdmsPath + setter.extendLinkPath + "attachFile/download?fileId=" + fileId;
        }
        // 删除
        $(document).on('click', '.deleteFile', function () {
            $(".uploadFileList").each(constructFileStr);
        });
        common.uploadfun(".fileUpload", {
            acceptMime: '${wjszsdsxlx}',
            exts: "${fileManagementUploadType}",
            secSelect: '<@secSelect.sec_select data_src=1 hasBlank=false/>',
            isSub: false,
            upLoadSize: 102400
        });


        //构建file的字符串
        function constructFileStr() {
            var filesJsonStr = "";
            $(this).find(".file-id").each(function () {
                var fileId = $(this).attr("fileid");
                var fileName = $(this).find("span").text();
                var fileLevel = $(this).find("option:selected").val();
                var fileLevelText = $(this).find("option:selected").text();
                filesJsonStr += '{"fileId":"' + fileId + '","fileName":"' + fileName + '","fileLevel":"' + fileLevel + '", "fileLevelText":"' + fileLevelText + '"},';
            });
            filesJsonStr = filesJsonStr.substring(0, filesJsonStr.length - 1);
            if (filesJsonStr != "") {
                filesJsonStr = '[' + filesJsonStr + ']';
            }
            var fileUploadName = $(this).attr("fileUploadName");
            $("#" + fileUploadName).val(filesJsonStr);
        }

        //-- 附件上传 结束 --------------------------------------------------------------

        var common = layui.common;
        var index = parent.layer.getFrameIndex(window.name);
        common.updateForm({
            name: 'wQbdTeamExpertgroupDataForm',
            idValue: "${id}",
            primary: "id",
            getCallback: function (data) {
                $("#tbxx").html("<td class='qbdms-zeroTable-lable'>填报信息:</td><td colspan='5' class=''>【" + data.data.filldept + " | " + data.data.fillman + " | " + data.data.filldate + "】</td>");

                // $("#tbxx").html("<span class='qbdms-TBinformation'>填报信息:</span><span class='qbdms-TBinformationText'>【" + data.data.filldept + " | " + data.data.fillman + " | " + data.data.filldate + "】</span>");
                //-修改页面 初始化附件组件 开始 ------------------------------------------
                $('.uploadFileList').each(function () {
                    var fileUploadName = $(this).attr("fileUploadName");
                    var jsonFile = data.data[fileUploadName];
                    var files = eval(jsonFile);
                    if (files) {
                        for (var i = 0; i < files.length; i++) {
                            var fileLevel = files[i].fileLevel;
                            var fileLevelText = files[i].fileLevelText;
                            var fileSec = '<div class="fileSecLevel fileSecXg layui-input-inline">' + '<@secSelect.sec_select data_src=1 hasBlank=false/>' + "</div>";
                            var newStr = '<span class="file-id" style="margin-right: 20px;" fileId=' + files[i].fileId + ' fileLevelText="' + fileLevelText + '">' + fileSec + '<span class="file-name" title="点击下载文件" onclick="downFile(this)"><i class="iconfont " style="margin-right: 5px"></i>' + files[i].fileName + '</span></span>';
                            $(this).html(newStr);
                            $(this).find("select:last").val(fileLevel);
                            $(this).find("select:last").attr("disabled", "disabled");
                        }
                    }
                });
                //-修改页面 初始化附件组件 结束 ------------------------------------------
                // -------------------- 明细判断附件是否存在 -------------------
                $(".uploadFileList").each(function () {
                    if ($(this).text().length == 0) {
                        $(this).append("<span style='color: #C0C4CC'>未上传</span>")
                    }
                })
                // -------------------- 明细判断附件是否存在 -------------------

            }
        });
        publicMethods.bottomFixd()
        $("body *").not("#closeWindow").attr("disabled", "disabled");
        $(".uploadFileCont .qbdms-fileUp,.uploadFileCont i,.addFormTr1").hide();
    });
</script>
</body>
</html>